package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;

/**
 * 日志实体
 */
@Data
@NoArgsConstructor
@TableName("t_log")
public class LogBean {
    @TableId(value = "pk_logId", type = IdType.AUTO)
    /**日志id*/
    private Integer id;
    @TableField("l_createDate")
    /**日期*/
    private LocalDate createDate = LocalDate.now();
    @TableField("l_content")
    /**内容*/
    private String content;
    public LogBean(String realName) {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
        String dateString = formatter.format(currentTime);
        this.content = "用户"+realName+"在"+dateString+"登录系统";
    }
}
